Should SVG's `<script>` element support the `fetchpriority` attribute analogous to HTML's `<script>` element?
Categories
(Core :: Networking, enhancement, P3)
Tracking
()
People
(Reporter: mbrodesser, Assigned: fredw)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-needed, Whiteboard: [necko-triaged], [wptsync upstream])
Attachments
(4 files)
Since https://svgwg.org/svg2-draft/interact.html#ScriptElement doesn't have the "fetchpriority" attribute yet (https://github.com/w3c/svgwg/issues/916)
Comment 1•2 years ago
|
||
Since we already support async, defer and module for SVG script elements perhaps we should just support fetchpriority too.
Reporter | ||
Comment 2•2 years ago
|
||
(In reply to Robert Longson [:longsonr] from comment #1)
Since we already support async, defer and module for SVG script elements perhaps we should just support fetchpriority too.
Yes, that's possible too.
Is there actually demand for it?
Comment 3•2 years ago
|
||
Probably not much yet given Chrome doesn't support any of this but someone has to go first.
Updated•2 years ago
|
Assignee | ||
Comment 4•1 year ago
|
||
This commit adds tests for the following cases, setting the expectations
to current behavior.
- SVG element <script async>
- SVG element <script defer>
- Dymically inserted SVG <script> element.
The fetchpriority
attribute is currently not defined for SVG
<script>
and a fortiori not implemented, so it does not influence
the internal priority.
The two first cases execute speculative parsing, but contrary to HTML
the async/defer attributes are not parsed and corresponding properties
considered false [1] so they don't influence the internal priority,
which remains PRIORITY_NORMAL.
The third case triggers non-speculative and is loaded asynchronously
so the internal priority is PRIORITY_LOW, just like HTML.
Updated•1 year ago
|
Assignee | ||
Comment 5•1 year ago
|
||
This commit adds fetchpriority tests for in-body SVG <script> elements.
Since the fetchpriority attribute is not specified on such elements,
and a fortiori not implemented, it has no effect on the internal
priority. Since we don't distinguish between "early" or "late" scripts
(bug 1872654) that internal priority always remains equal to
PRIORITY_NORMAL. We set expectations to current behavior.
Assignee | ||
Comment 6•1 year ago
|
||
This patch is similar to D201676 but for type="module" SVG <scripts>.
The difference is that speculative parsing for SVG does take into account
the type attribute so they are assigned PRIORITY_HIGH when fetchpriority
is enabled (and remains PRIORITY_NORMAL otherwise).
Assignee | ||
Comment 7•1 year ago
|
||
(In reply to Robert Longson [:longsonr] from comment #1)
Since we already support async, defer and module for SVG script elements perhaps we should just support fetchpriority too.
FWIW I did some testing (see attached patches) and, in addition to ignoring the fetchpriority attribute, the differences seem to be:
(1) It is not possible to have SVG script the in head element when initially parsing the document via the HTML5 parser (unless I'm missing something?)
(2) async/defer attributes are not taken into account when doing speculative parsing. I wonder whether we should fix that?
Comment 8•1 year ago
|
||
(In reply to Frédéric Wang (:fredw) from comment #7)
(In reply to Robert Longson [:longsonr] from comment #1)
Since we already support async, defer and module for SVG script elements perhaps we should just support fetchpriority too.
FWIW I did some testing (see attached patches) and, in addition to ignoring the fetchpriority attribute, the differences seem to be:
(1) It is not possible to have SVG script the in head element when initially parsing the document via the HTML5 parser (unless I'm missing something?)
I don't think you're missing anything.
(2) async/defer attributes are not taken into account when doing speculative parsing. I wonder whether we should fix that?
I imagine we should fix that.
Assignee | ||
Comment 9•1 year ago
|
||
(In reply to Robert Longson [:longsonr] from comment #8)
(2) async/defer attributes are not taken into account when doing speculative parsing. I wonder whether we should fix that?
I imagine we should fix that.
FWIW, I believe this would be a straightforward fix at the place Mirko already left a comment: https://searchfox.org/mozilla-central/rev/9bb5d5f55da6cc7163dd93825c25609b769822f9/parser/html/nsHtml5TreeBuilderCppSupplement.h#564
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Comment 10•1 year ago
|
||
After bug 1880433, the SVG script would all default to normal priority when fetchpriority is enabled, so we can land these patches without waiting for the fix to bug 1880046.
Assignee | ||
Updated•1 year ago
|
Comment 11•1 year ago
|
||
Comment 12•1 year ago
|
||
bugherder |
Comment 13•10 months ago
|
||
The leave-open keyword is there and there is no activity for 6 months.
:smayya, maybe it's time to close this bug?
For more information, please visit BugBot documentation.
Updated•9 months ago
|
Comment 14•1 month ago
|
||
Comment 15•1 month ago
|
||
Comment 16•1 month ago
|
||
Comment 17•1 month ago
•
|
||
Backed out for causing wpt failures @ttr-image-fetchpriority.html and @attr-script-fetchpriority.html.
- Backout link
- Push with failures
- Failure Log
- Failures Log build bustages
Updated•1 month ago
|
Comment 18•1 month ago
|
||
Comment 20•1 month ago
|
||
bugherder |
Updated•1 month ago
|
Updated•1 month ago
|
Comment 22•1 month ago
|
||
fetchpriority is now implemented on SVGScriptElement.webidl, SVGImageElement.webidl and SVGFEImageElement.webidl.
SVG script, image and feImage elements now work the same as HTML script and img elements in supporting fetchpriority. I.e. https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/fetchPriority
Updated•1 month ago
|
Description
•